package com.hp.mapper;

import com.hp.entity.ApplyDB;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;


public interface ApplyMapper {
    /**
     *  @Results 注解中写入@Result(column="数据库字段名", property="实体类属性名", jdbcType=数据库字段的数据类型)
     *     此注解可解决@Select部分属性获取不到数据库的值
     * @return
     */
    @Select("SELECT * FROM apply_info")
    @Results({ @Result(column="class", property="className", jdbcType= JdbcType.VARCHAR)})
    List<ApplyDB> app();

    @Select("SELECT * FROM apply_info WHERE applyId =#{appId}")
    @Results({ @Result(column="class", property="className", jdbcType= JdbcType.VARCHAR)})

    List<ApplyDB> ap(int id);

    @Select("SELECT * FROM apply_info WHERE NAME LIKE#{name} AND game=#{game}")
    @Results({ @Result(column="class", property="className", jdbcType= JdbcType.VARCHAR)})
    List<ApplyDB> mohu(String name,String game);

    @Insert("INSERT INTO apply_info VALUES (NULL,#{name},#{age},#{className},#{game})")
    void Tj(ApplyDB tianjia);

    @Update("UPDATE apply_info SET NAME = #{name} WHERE applyId = #{appId}")
    void Xg(ApplyDB xiugai);

    @Delete("DELETE FROM apply_info WHERE applyId = #{appId} ")
    void Sc(int id);
}
